package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.FePropertyMapper;
import com.ruoyi.omp.api.domain.FeProperty;
import com.ruoyi.life.service.IFePropertyService;

/**
 * 物业费用Service业务层处理
 *
 * @author cjie
 * @date 2021-09-17
 */
@Service
public class FePropertyServiceImpl implements IFePropertyService {
    @Autowired
    private FePropertyMapper fePropertyMapper;

    /**
     * 查询物业费用
     *
     * @param id 物业费用ID
     * @return 物业费用
     */
    @Override
    public FeProperty selectFePropertyById(String id) {
        return fePropertyMapper.selectFePropertyById(id);
    }

    /**
     * 查询物业费用列表
     *
     * @param feProperty 物业费用
     * @return 物业费用
     */
    @Override
    public List<FeProperty> selectFePropertyList(FeProperty feProperty) {

        return fePropertyMapper.selectFePropertyList(feProperty);
    }

    /**
     * 新增物业费用
     *
     * @param feProperty 物业费用
     * @return 结果
     */
    @Override
    public int insertFeProperty(FeProperty feProperty) {
        feProperty.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        feProperty.setCreateTime(DateUtils.getNowDate());
        feProperty.setCreateBy(SecurityUtils.getUsername());
        return fePropertyMapper.insertFeProperty(feProperty);
    }

    /**
     * 修改物业费用
     *
     * @param feProperty 物业费用
     * @return 结果
     */
    @Override
    public int updateFeProperty(FeProperty feProperty) {
        feProperty.setUpdateTime(DateUtils.getNowDate());
        feProperty.setUpdateBy(SecurityUtils.getUsername());
        return fePropertyMapper.updateFeProperty(feProperty);
    }

    /**
     * 批量删除物业费用
     *
     * @param ids 需要删除的物业费用ID
     * @return 结果
     */
    @Override
    public int deleteFePropertyByIds(String[] ids) {
        return fePropertyMapper.deleteFePropertyByIds(ids);
    }

    /**
     * 删除物业费用信息
     *
     * @param id 物业费用ID
     * @return 结果
     */
    @Override
    public int deleteFePropertyById(String id) {
        return fePropertyMapper.deleteFePropertyById(id);
    }
}
